package com.zks.example;

import org.junit.Test;

import java.util.concurrent.atomic.AtomicStampedReference;

public class People {



    private String name;

    public People(){}
    public People(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    /**
     * 覆盖finalize，在回收的时候会执行。
     * @throws Throwable
     */
    @Override
    protected void finalize() throws Throwable {
        super.finalize();
        System.out.println("People： " + name + " finalize。");
    }

    @Override
    public String toString() {
        return "People{" +
                "name='" + name + '\'' +
                '}' + ", hashCode:" + this.hashCode();
    }



}
